#ifndef _EMAC_H_
#define _EMAC_H_

#include "semaphores.h"
#include "emac_rx.h"
#include "emac_tx.h"

#define MAX_BUFFERS_PER_LIST 4

typedef struct
{
   sem_t *emac_rx_sem;
   emac_rx_ctx_t *rx_ctx;
   emac_tx_ctx_t *tx_ctx;
}emac_cfg_t;


typedef struct gather_list_t
{
  bool     pending_pkt_flush;  // request to flush out pending packets awaiting arp respose
  uint16_t num_entries;
  struct {
      uint8_t *buf_ptr;
      uint16_t len;
  }buf_list[MAX_BUFFERS_PER_LIST];
  
  struct gather_list_t *next;   // next packet in queue
  struct gather_list_t *prev;
}gather_list_t;

void emac_cfg(uint32_t data);
void emac_init(void);
void emac_rxfun(void);
void emac_txfun(void);
void initialize_emac_interrupts(void);

#endif
